package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-07-07
 * Time: 19:36
 */
public class BookList {
    private Book[] books = new Book[10];  //这个书架存放10本书，具体存放几本书可以修改。
    private int bookSize;                 //当前书架上图书的数目

    //无参数的构造方法
    public BookList() {
        books[0] = new Book("三国演义","罗贯中",20,"小说");
        books[1] = new Book("水浒传","施耐庵",20,"小说");
        books[2] = new Book("西游记","吴承恩",20,"小说");
        books[3] = new Book("红楼梦","曹雪芹",20,"小说");

        this.bookSize = 4;
    }
    //先往书架上放4本书

    //以下为Book类中字段的访问方法：

    public Book getBook(int i) {  //获取第i本图书
        return books[i];
    }

    public int getBookSize() {
        return bookSize;
    }

    public Book[] getBooks() {  //获取图书数组，即书架
        return books;
    }

    //将新增的图书放到书架上
    public void setBooks(int sz,Book book) {
        this.books[sz] = book;
    }

    public void setBookSize(int bookSize) {
        this.bookSize = bookSize;
    }
}
